package leetcode.D500.T448;

import java.util.ArrayList;
import java.util.List;

class Solution {
    public List<Integer> findDisappearedNumbers(int[] nums) {
        List<Integer> result = new ArrayList<>();
        for (int i = 0; i < nums.length; i++) {
            int index = (nums[i] - 1) % nums.length;
            nums[index] += nums.length;
        }
        for (int i=0; i<nums.length; ++i) {
            if (nums[i] <= nums.length)
                result.add(i + 1);
        }
        return result;
    }
}